-
Notifications
You must be signed in to change notification settings - Fork 94
SHA-256 Hash #1725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
SHA-256 Hash #1725
Conversation
20e4b85
to
e2f1815
Compare
8b063e6
to
d99da0e
Compare
85c283e
to
774eb29
Compare
2f73b59
to
df8311e
Compare
Signed-off-by: Alexander-Ger-Reich <[email protected]>
df8311e
to
012b77b
Compare
DCO is happy |
Signed-off-by: Alexander-Ger-Reich <[email protected]>
Signed-off-by: Alexander-Ger-Reich <[email protected]>
Signed-off-by: Alexander-Ger-Reich <[email protected]>
Signed-off-by: Alexander-Ger-Reich <[email protected]>
Signed-off-by: Alexander-Ger-Reich <[email protected]>
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello
Thank you for the PR.
I've suggested a few naming changes to align with the naming conventions used throughout the project for consistency. I will also be testing the PR shortly.
@@ -135,8 +138,55 @@ private int downloadFile(OwnCloudClient client, File targetFile) throws IOExcept | |||
transferEncoding = "chunked".equals(transferEncodingHeader.getValue()); | |||
} | |||
|
|||
if (transferred == totalToTransfer || transferEncoding) { | |||
savedFile = true; | |||
if (transferred == totalToTransfer || transferEncoding) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, could you apply the fail fast here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having nested if-else blocks, you can return early. However, I think the downloadFile() function is too complex for that. We can skip it, if it’s too much work to refactor.
e.g.
Before:
public void checkAge(int age) {
if (age >= 0) {
if (age >= 18) {
System.out.println("User is an adult.");
} else {
System.out.println("User is a minor.");
}
} else {
System.out.println("Invalid age.");
}
}
After:
public void checkAge(int age) {
if (age < 0) {
System.out.println("Invalid age.");
return;
}
if (age >= 18) {
System.out.println("User is an adult.");
return;
}
System.out.println("User is a minor.");
}
library/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java
Outdated
Show resolved
Hide resolved
library/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java
Outdated
Show resolved
Hide resolved
library/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/owncloud/android/lib/resources/files/ChunkedFileUploadRemoteOperation.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/owncloud/android/lib/resources/files/ChunkedFileUploadRemoteOperation.java
Outdated
Show resolved
Hide resolved
library/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java
Outdated
Show resolved
Hide resolved
library/src/main/java/com/owncloud/android/lib/common/OwnCloudClientManagerFactory.java
Outdated
Show resolved
Hide resolved
library/src/main/java/com/owncloud/android/lib/resources/files/DownloadFileRemoteOperation.java
Outdated
Show resolved
Hide resolved
library/src/main/java/com/owncloud/android/lib/resources/files/DownloadFileRemoteOperation.java
Outdated
Show resolved
Hide resolved
…ClientManagerFactory.java Signed-off-by: Alexander-Ger-Reich <[email protected]> Co-authored-by: Alper Öztürk <[email protected]> Signed-off-by: Alexander-Ger-Reich <[email protected]>
Signed-off-by: Alexander-Ger-Reich <[email protected]> Co-authored-by: Alper Öztürk <[email protected]> Signed-off-by: Alexander-Ger-Reich <[email protected]>
I wrote an add-on that requires the client to provide the SHA-256 hash of the uploaded files and chunks.